package com.prs.crm.dao.oa.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.dao.oa.HomePageDao;
import com.prs.crm.domain.oa.HomePage;
import com.prs.crm.domain.oa.HomePageType;

public class HomePageDaoImpl extends BaseDaoImpl<HomePage> implements HomePageDao{

	@Override
	public List<HomePage> getPageByType(HomePageType type) {
		Criteria criteria = this.getSession().createCriteria(HomePage.class);
		criteria.add(Restrictions.eq("type", type));
		List<HomePage> r= criteria.list();
		if(r.size()!=0){
			return r;
		}else{
			return null;
		}
	}

	@Override
	public List<HomePage> getAllHomePage() {
		Criteria criteria = this.getSession().createCriteria(HomePage.class);
		return criteria.list();
	}

}
